<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Modern Business - Start Bootstrap Template</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.css" rel="stylesheet">

    <!-- Add custom CSS here -->
    <link href="css/modern-business.css" rel="stylesheet">
    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="css/egroupstyle.css" rel="stylesheet">
</head>

<body>

    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <!-- You'll want to use a responsive image option so this logo looks good on devices - I recommend using something like retina.js (do a quick Google search for it and you'll find it) -->
                <a class="navbar-brand" href="index.html">Egroup Team</a>
            </div>
            <div>
                <ul class="nav navbar-nav">
                    <li class="dropdown"><a href="about.html"><i class="fa fa-user"></i>&nbsp;Hi,Epartner <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            <li><a href="#">登出</a>
                            </li>
                            <li><a href="#">基本資管理</a>
                            </li>
                        </ul>
                    </li>
                </ul>  
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse navbar-ex1-collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="bootstraptheme.html">colorfulTheme</a>
                    </li>

                     <li class="dropdown active">
                        <a href="news.html" class="dropdown-toggle" data-toggle="dropdown">內文管理 <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            <li><a href="news.html">消息管理</a>
                            </li>
                            <li><a href="newsDetail.html">消息編輯</a>
                            </li>
                            <li><a href="newssort.html">分類管理</a>
                            </li>
                        </ul>
                    </li>
                    <li class="dropdown">
                        <a href="banner.html" class="dropdown-toggle" data-toggle="dropdown">介面管理 <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            <li><a href="banner.html">banner管理</a>
                            </li>
                            <li><a href="picture.html">輪播管理</a>
                            </li>
                            <li><a href="footer.html">頁尾管理</a>
                            </li>
                        </ul>
                    </li>
                    <li class="dropdown">
                        <a href="search.html" class="dropdown-toggle" data-toggle="dropdown">更多頁面 <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            <li><a href="search.html">搜尋頁面</a>
                            </li>
                            <li><a href="block.html">方格頁面</a>
                            </li>
                            <li><a href="404.html">404</a>
                            </li>                            
                        </ul>
                    </li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">多層頁面<b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            <li><a href="sidebarleft.html">左連結頁</a>
                            </li>
                            <li><a href="cleanpage.html">上連結頁</a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container -->
    </nav>


    <div class="container tablestyle">

        <div class="row">

            <div class="col-lg-12">
                <h2 class="page-header">創業密技管理
                </h2>
                <a class="btn btn-success btn-sm" href="insertBlogCont">
                  	<span class="glyphicon glyphicon-plus"></span> 新增創業密技
                </a>             
                <br /><br />

                <div class="bs-component">
                  <table class="table table-striped table-hover table-bordered">
                    <thead>
                      <tr>
                        <th>標題</th>            
                        <th width="80">留言</th>
                        <th width="80">編輯</th>
                        <th width="80">刪除</th>
                      </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${blogList}" var="blog">
                      <tr>
                        <td>${blog.title}</td>
                        <td>
                        <c:choose>
                        	<c:when test="${blog.countMessage > 0}">                        	
	                        <a class="btn btn-xs ${blog.countNewMessage>0?'btn-default':'btn-success'}" href="manageBlogMessage?bid=${blog.id}">
	                            <span class="glyphicon ${blog.countNewMessage>0?'glyphicon-pencil':'glyphicon-list-alt'}"></span>  
	                            ${blog.countNewMessage > 0 ? '查看新留言' : '查看留言'}
	                        </a>    
                        	</c:when>
                        	<c:otherwise>
						    	尚無留言
						    </c:otherwise>
                        </c:choose>               
                        </td>
                        <td>
	                        <a class="btn btn-xs btn-default" href="updateBlogCont?id=${blog.id}">
	                            <span class="glyphicon glyphicon-pencil"></span>  編輯
	                        </a>                   
                        </td>
                        <td>
	                        <button class="btn btn-xs btn-default deleteBtn" data-id="${blog.id}">
	                            <span class="glyphicon glyphicon-trash"></span>  刪除
	                        </button>
                        </td>
                      </tr>
                    </c:forEach>                  
                                       
                    </tbody>
                  </table> 
                 
            
                </div><!-- /example -->
            </div>
            


        </div>
        <div class="row">
        <div class="col-sm-6"></div>
        <div class="col-sm-6 text-right">

			<div class="page clearfix">
				<ul>
				<c:forEach items="${page.pagerList}" var="pager">
					<li class="${pager.indexClass}"><a href="${pager.url}">${pager.index}</a></li>
				</c:forEach>			
				</ul>
			</div><!-- page -->             
        </div>
        </div>        
    </div>


    <div class="container">

        <hr>

        <footer>
            <div class="row">
                <div class="col-lg-12">
                    <p>Copyright &copy; Company 2013</p>
                </div>
            </div>
        </footer>

    </div>
    <!-- /.container -->

	<form id="deleteForm" method="post" action="deleteBlog">
		<input type="hidden" name="id" id="id">
	</form>
	
    <!-- JavaScript -->
    <script src="js/jquery-1.10.2.js"></script>
    <script src="js/bootstrap.js"></script>
    <script src="js/modern-business.js"></script>
	<script type="text/javascript">
	$(".deleteBtn").click(function(){
		var r = confirm("是否要刪除");
		if(r == true){
			var id = $(this).attr("data-id");
			$("#id").val(id);
			$("#deleteForm").submit(); 
		}
		else{
			return false;
		}
	});
	</script>
</body>

</html>
